<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.求1-100之间所有数的平均值
        var sum = 0;
        var avg = 0;
        for (var i = 1; i <= 100; i++) {
            sum += i;
        }
        avg = sum / 100
        console.log(avg);
        // 2.求1-100之间所有偶数和奇数的和
        var even = 0;
        var odd = 0;
        for (var j = 1; j <= 100; j++) {
            if (j % 2 == 0) {
                even += j;
            } else {
                odd += j;
            }
        }
        console.log(even);
        console.log(odd);
        // 3.求1-100之间能够被3整除的数字的和
        var three = 0;
        for (var k = 1; k <= 100; k++) {
            if (k % 3 == 0) {
                three += k;
            }
        }
        console.log(three);
    </script>
</body>

</html>